package com.greendragon.service.frontend.impl; 

import java.util.List;

import com.greendragon.persistence.dao.ICategoryDao;
import com.greendragon.persistence.domain.ProductCategory;
import com.greendragon.persistence.enmu.FetchOrderType;
import com.greendragon.service.frontend.ICategoryFrontendService;

/** 
 * @author wulibin, exceptsky@gmail.com, 2011-9-9 上午07:28:24
 * 
 */
public class ProductCategoryFrontendService extends BaseFrontendService<ProductCategory> implements ICategoryFrontendService<ProductCategory>{
	private ICategoryDao<ProductCategory> categoryDao;
	
	@Override
	public ProductCategory getByName(String name){
		return categoryDao.getByName(name);
	}
	
	@Override
	public List<ProductCategory> getAllRootCategories(int page){
		return categoryDao.getAllRootCategories(page*pageLength, pageLength, FetchOrderType.CREATE_DESC);
	}
	
	public void setCategoryDao(ICategoryDao<ProductCategory> categoryDao) {
		this.categoryDao = categoryDao;
		this.setDao(categoryDao);
	}

}
 